import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    component: HomeView
  },
  {
    path: '/about',
    redirect: '/center/index',
    component: () => import('../views/AboutView'),
    children:[
      {
        path: '/center/index',
        component: () => import('../views/center/homeIndexView')
      },
      {
        path: '/center/condiction',
        component: () => import('../views/center/homeCondictionView')
      },
      {
        path: '/center/product',
        component: () => import('../views/center/homeproductView')
      },
      {
        path: '/center/cart',
        component: () => import('../views/center/homeCartView')

      }
    ]
  },
  {
    path: '/admin',
    redirect:'/sys-admin/home',
    component: () => import('../views/AdminView.vue'),
    children:[
      {
        path: '/sys-admin/home',
        component: () => import('../views/sys.admin/homeView')
      },
      {
        path: '/sys-admin/banner/add-new',
        component: () => import('../views/sys.admin/banner/bannerAddNewView')
      },
      {
        path: '/sys-admin/banner/list',
        component: () => import('../views/sys.admin/banner/bannerListItemView')
      },
      {
        path: '/sys-admin/product/add-new',
        component: () => import('../views/sys.admin/product/productAddNewView')
      },
      {
        path: '/sys-admin/product/list',
        component: () => import('../views/sys.admin/product/productListItemView')
      },
      {
        path: '/sys-admin/orders/list',
        component: () => import('../views/sys.admin/orders/ordersListItemView')
      }
    ]
  },
  {
    path: '/sys-admin/user/find',
    component: () => import('../views/sys.admin/user/findView')
  },
  {
    path: '/sys-admin/user/register',
    component: () => import('../views/sys.admin/user/registerView')
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
